package com.ruoyi.system.listener;


import com.ruoyi.system.domain.event.OrderMessageEvent;
import com.ruoyi.system.service.IHospitalSubscribeUserMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 用户订单消息事件监听器
 */
@Component
public class UserOrderMessageListener {


    @Autowired
    private IHospitalSubscribeUserMessageService iHospitalSubscribeUserMessageService;

    @EventListener
    @Order(0)
    @Async
    public void saveUserOrder(OrderMessageEvent orderMessageEvent){
        iHospitalSubscribeUserMessageService.saveOrderMessage(orderMessageEvent.getOrderNo(),orderMessageEvent.getContent(),orderMessageEvent.getUserId());
    }
}
